import type { VxeGridPropTypes } from 'vxe-table';
import type { OrderStatus } from '#/api/wedding';

// 表格列配置
export const columns: VxeGridPropTypes.Columns = [
  { type: 'checkbox', width: 50, fixed: 'left' },
  { field: 'orderId', title: '订单号', width: 200, fixed: 'left' },
  { field: 'customerName', title: '客户姓名', width: 120 },
  { field: 'customerPhone', title: '客户电话', width: 130 },
  { field: 'weddingDate', title: '婚期', width: 120 },
  { field: 'totalAmount', title: '总金额(元)', width: 120 },
  { field: 'paidAmount', title: '已付金额(元)', width: 120 },
  { field: 'discountAmount', title: '优惠金额(元)', width: 120 },
  { field: 'status', title: '状态', width: 100, slots: { default: 'status' } },
  {
    field: 'createTime',
    title: '创建时间',
    width: 180,
  },
  {
    title: '操作',
    width: 180,
    fixed: 'right',
    slots: { default: 'action' },
  },
];

// 订单状态选项
export const orderStatusOptions = [
  { label: '草稿', value: 'DRAFT' as OrderStatus, color: 'default' },
  { label: '已确认', value: 'CONFIRMED' as OrderStatus, color: 'processing' },
  { label: '已支付', value: 'PAID' as OrderStatus, color: 'success' },
  { label: '进行中', value: 'IN_PROGRESS' as OrderStatus, color: 'warning' },
  { label: '已完成', value: 'COMPLETED' as OrderStatus, color: 'success' },
  { label: '已取消', value: 'CANCELLED' as OrderStatus, color: 'error' },
];

// 服务类型选项
export const serviceTypeOptions = [
  { label: '婚纱', value: 'DRESS' },
  { label: '化妆', value: 'MAKEUP' },
  { label: '摄影', value: 'PHOTOGRAPHY' },
  { label: '套餐', value: 'PACKAGE' },
];

// 获取状态文本
export function getOrderStatusText(status: OrderStatus): string {
  const option = orderStatusOptions.find((item) => item.value === status);
  return option?.label || status;
}

// 获取状态颜色
export function getOrderStatusColor(status: OrderStatus): string {
  const option = orderStatusOptions.find((item) => item.value === status);
  return option?.color || 'default';
}

